{{template "admin/public/head.html" .}}
<section>
	<aside>
		{{template "admin/public/nav.html" .}}
	</aside>
	<article>
		<div class="top-title">
			<dl>
				<dt><h1>{{.title}}</h1></dt>
				<dd>&nbsp;</dd>
				<dd><a href="wood_help.html"><i class="iconfont">&#xe649;</i>帮助文档</a></dd>
			</dl>
		</div>
		<!-- <div class="nav1">
			<ul>
				<a href="works_index.html" class="no"><li>全部产品</li></a>
				<a href="works_index.html"><li>产品分类</li></a>
				<a href="works_index.html"><li>产品分类</li></a>
				<a href="works_index.html"><li>产品分类</li></a>
				<a href="works_index.html"><li>产品分类</li></a>
				<a href="works_index.html"><li>产品分类</li></a>
			</ul>
		</div> -->
		<div class="content">
			<div class="release">
				<dl>
					<dt><i class="iconfont">&#xe649;</i> <b>{{.title}}说明</b><br>
						<p>根据需要先选择栏目,<mark>在选择产品</mark></p>
						<p>只选择栏目无效</p>
					</dt>
				</dl>
			</div>
			<form action="" method="get" autocomplete="on" class="form">

				<table class="table1">
					<!-- 控制表格宽度  横向合并 colspan="1"  竖向合并 rowspan="3" -->
					<thead><th width="10%"></th><th width="15%"></th><th width="10%"></th><th width="15%"></th><th width="10%"></th><th width="15%"></th><th width="10%"></th><th width="15%"></th></thead>
					<tr>
						<td class="genre">名称</td>
						<td colspan="3">
							<input type="text" class="input95" placeholder="请输入名称！" name="name" value="{{.info.name}}">
						</td>
						<td class="genre">排序</td>
						<td colspan="3">
							<input type="number" class="input95" placeholder="请输入排序！" name="sort" value="{{.info.sort}}">
						</td>
					</tr>
					<tr>
						<td class="genre">简介</td>
						<td colspan="7">
							<input type="text" class="input95" placeholder="请输入简介！" name="intr" value="{{.info.intr}}">
						</td>
					</tr>
					<tr>
						<td class="genre">活动时间</td>
						<td colspan="7">
							<input type="text" class="input95" name="activetime" value="{{.info.activetime}}" placeholder="如: 1月19日-2月19日">
						</td>
					</tr>
					<tr>
						<td class="genre">PC端主图</td>
						<td colspan="7">
							<div class="thumbnail">
								<dl><dt><img src="{{.info.pathname}}" class="uppic"><input type="file" onchange="uppic(this,'function')" accept="image/gif,image/jpeg,image/jpg,image/png,image/svg">
									<input type="hidden" name="img" value="{{.info.img}}"></dt><dd>缩略图</dd><dd class="del_img">删除图片</dd></dl>
							</div>
						</td>
					</tr>
					<tr>
						<td class="genre">移动端表达背景图</td>
						<td colspan="7">
							<div class="thumbnail">
								<dl><dt><img src="{{.info.bgImgpathname}}" class="uppic"><input type="file" onchange="uppic(this,'function')" accept="image/gif,image/jpeg,image/jpg,image/png,image/svg">
									<input type="hidden" name="bgImg" value="{{.info.bgImg}}"></dt><dd>缩略图</dd><dd class="del_img">删除图片</dd></dl>
							</div>
						</td>
					</tr>
					<tr>
						<td class="genre">移动端主图</td>
						<td colspan="7">
							<div class="thumbnail">
								<dl><dt><img src="{{.info.mobilepathname}}" class="uppic"><input type="file" onchange="uppic(this,'function')" accept="image/gif,image/jpeg,image/jpg,image/png,image/svg">
									<input type="hidden" name="mobileImg" value="{{.info.mobileImg}}"></dt><dd>缩略图</dd><dd class="del_img">删除图片</dd></dl>
							</div>
						</td>
					</tr>
					<style type="text/css">
						.product{display: none;}
						.checkbox{float: left;}
					</style>
					<tr>
						<td colspan="8"><input type="text" class="select95 sx" placeholder="筛选(全部)"></td>
					</tr>
					{{range .column}}
					<tr id="{{.id}}">
						<td class="genre" colspan="2"><label class="checkbox"><input type="checkbox" name="cid" value="{{.id}}" {{if $.info.cid}}{{tipcheck .id $.info.cid}}{{end}}>{{.name}}</label></td>
						<!-- <td colspan="6"><input type="text" pid="{{.id}}" class="select95 sx" placeholder="筛选"></td> -->
					</tr>
					<tr class="product" pid="{{.id}}">
						<td colspan="8">
							{{range .product}}
							<label class="checkbox"><input type="checkbox" name="pid" value="{{.id}}" {{if $.info.pid}}{{tipcheck .id $.info.pid}}{{end}}>{{.title}}</label>
							{{end}}
						</td>
					</tr>
					{{end}}
					<input type="hidden" name="id" value="{{.info.id}}">
					<input type="hidden" name="defaultsort" value="{{.info.defaultsort}}">
			</form>
					<tr class="trbutton">
						<td colspan="2"><button type="button" class="button">保存</button></td>
						<td colspan="6">
							<p>
								<i class="iconfont">&#xe649;</i> 请检查内容确认发布的内容没有涉及传播谣言、政治话题或违反广告法夸大宣传产品等。
							</p>
							<div class="help">帮助
								<div class="help_qr"><img src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/all/qr-code.jpg" alt=""></div>
							</div>
						</td>
					</tr>
				</table>


		</div>
	</article>
</section>

<footer><!-- 系统监控内容 --></footer>
<script src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/admin/js/jquery.jedate.min.js"></script>
<script src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/admin/js/toast.js"></script>
<script src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/admin/js/uppic.js"></script>
<script src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/admin/js/xcConfirm.js"></script>
<script src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/admin/js/app.js"></script>
<script>
	console.log(111)
	function request(paras){
	　　var url = location.href;

	　　var paraString = url.substring(url.indexOf("?")+1,url.length).split("&");

	　　var paraObj = {}

	　　for (i=0; j=paraString[i]; i++){
	　　paraObj[j.substring(0,j.indexOf("=")).toLowerCase()] = j.substring(j.indexOf("=")+1,j.length);

	　　}

	　　var returnValue = paraObj[paras.toLowerCase()];

	　　if(typeof(returnValue)=="undefined"){
	　　return "";

	　　}else{
	　　   return returnValue;
	　　}
　　}
	
	$('input[name="cid"]').click(function(){
		var check=$(this).prop('checked')
		var id=$(this).parent().parent().parent().attr('id')
		if(check){
			$('tr[pid='+id+']').css('display','table-row')
		}else{
			$('tr[pid='+id+']').css('display','none')
		}
	})
	$('input[name="cid"]').each(function(){
		var check=$(this).prop('checked')
		var id=$(this).parent().parent().parent().attr('id')
		if(check){
			$('tr[pid='+id+']').css('display','table-row')
		}else{
			$('tr[pid='+id+']').css('display','none')
		}

	})
	$('.sx').bind('keypress', function(){
		if(event.keyCode == "13"){
			var val=$(this).val()
			var id=$(this).attr('pid')
			var input;
			window.location.href = "/admin/program/edit?"+$('form').serialize() + "&val=" + val
			// if(id){
			// 	 input=$('tr[pid='+id+']').find('.checkbox')
			// }else{
			// 	 input=$('.product').find('.checkbox')
			// }
			// if(val==''){
			// 	input.each(function(){
			// 		$(this).css('display','table')
			// 	})
			// }else{
			// 	input.each(function(){
			// 		var res=$(this).text().indexOf(val)
			// 		if(res==-1){
			// 			$(this).css('display','none')
			// 		}else{
			// 			$(this).css('display','table')
			// 		}
			// 	})
			// }
        }
		
	})
	
	$('.button').click(function(){
		if (!$('input[name="name"]').val()){
			window.wxc.xcConfirm("请输入名称！","info"); return false;
		}
		if (!$('input[name="img"]').val()){
			window.wxc.xcConfirm("请上传PC端图片！","info"); return false;
		}
		if (!$('input[name="bgImg"]').val()){
			window.wxc.xcConfirm("请上传移动端背景图片！","info"); return false;
		}
		if (!$('input[name="mobileImg"]').val()){
			window.wxc.xcConfirm("请上传移动端主图图片！","info"); return false;
		}
		var form=$('form').serialize()
		$.ajax({
			url:window.location.href,
			data:form,
			type:'post',
			success:function(res){
				if(res==1){
					 window.wxc.xcConfirm("保存成功","success",{onClose:function(){
                        window.location.href = document.referrer
                    }})
				}else {
					 window.wxc.xcConfirm("保存失败,请重试!","error")
				}
			}
		})
	});
</script>
</body>
</html>
